package com.hangzhou.xyj.net.request;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.hangzhou.xyj.net.request.base.BaseRequest;
import com.hangzhou.xyj.utils.constants.API;

/**
 * Created by yaohuix on 2016/2/25  11:30
 * <p/>
 * 说明：发现-新建圈子 请求
 */
public class SaveGroupReq extends BaseRequest {

    /**
     * @param createUserId 创建人ID
     * @param location     城市
     * @param groupName    圈子名
     * @param description  圈子简介
     * @param catType      剧种ID
     * @param catTypeStr   剧种名称
     * @param groupIconUrl 圈子图标的url
     * @return
     * @author yaohuix
     * @date 2016/4/22 9:41
     */
    public SaveGroupReq(int createUserId, String location, String groupName, String description, int catType, String catTypeStr, String groupIconUrl) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("createUserId", createUserId);
        jsonObject.addProperty("location", location);
        jsonObject.addProperty("name", groupName);
        jsonObject.addProperty("description", description);
        jsonObject.addProperty("catType", catType);
        jsonObject.addProperty("catTypeStr", catTypeStr);
        jsonObject.addProperty("image", groupIconUrl);
        String jsonStr = new Gson().toJson(jsonObject);
        add("data", jsonStr);
    }

    @Override
    public String getUrl() {
        return API.SAVE_GROUP;
    }
}
